FLAGS = -fPIC

PYTHONI = $(shell python3.9-config --cflags)
PYTHON_LDFLAGS = $(shell python3.9-config --ldflags)
PYTHONL = -Xlinker -export-dynamic

objects = graph_core
object_files = graph.o graphd.o outer.o basic.o algorithm_graphd.o algorithm_graph.o

all: $(objects)
	swig -c++ -python -o graph_wrap.cxx graph.i
	g++ $(FLAGS) $(PYTHONI) -c graph_wrap.cxx -o graph_wrap.o
	g++ $(PYTHONL) $(PYTHON_LDFLAGS) -shared $(object_files) graph_wrap.o -o _graph_core.so -lpthread


graph_core:
	g++ -fPIC -c graph.cpp -o graph.o
	g++ -fPIC -c outer.cpp -o outer.o
	g++ -fPIC -c basic.cpp -o basic.o
	g++ -fPIC -c graphd.cpp -o graphd.o
	g++ -fPIC -c algorithm_graphd.cpp -o algorithm_graphd.o
	g++ -fPIC -c algorithm_graph.cpp -o algorithm_graph.o

clean:
	rm -rf *.o *.cxx *.so *.py __pycache__

